<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>823680621@qq.com</title>
	<style>
		#box{
			width: 100px;
			height: 100px;
			background: red;
			position: absolute;
			left: 100px;
			top: 150px;
		}
	</style>
</head>
<body>
	<div id="box" draggable="true"></div>
</body>
<script>
	// box.ondragover=function(e){//鼠标按下
	// 	this.style.cssText="left:"+(e.clientX-100/2)+"px;top:"+(e.clientY-150/2)+"px;"
	// }
	

	box.ondragend=function(e){//鼠标松开
		this.style.cssText="left:"+(e.clientX-100/2)+"px;top:"+(e.clientY-150/2)+"px;"
	}
</script>
</html>